﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.world {
    import net.wooga.pets.events.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class OnTreatmentFinishedCommand extends Command {

		[Inject]
        public var event:InfoEvent;
		[Inject]
        public var world:WorldModel;

        override public function execute():void{
            var _local1:ITreatable = ITreatable(this.event.info);
            _local1.currentTreatment.finish();
            dispatch(new InfoEvent(EventConstants.TREATMENT_STATUS_UPDATED, EventConstants.ON_TREATMENT_FINISHED, _local1.currentTreatment));
            this.preloadFinishedPatient(_local1);
        }
        private function preloadFinishedPatient(_arg1:ITreatable):void{
            var _local2:String = ((_arg1.type + "_") + _arg1.diseaseName);
            var _local3:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST);
            _local3.addAssetRequest(ProtocolConstants.LOAD_PATIENT, _local2.toLowerCase(), ProtocolConstants.PRELOADING_PIPE);
            dispatch(_local3);
        }

    }
}//package net.wooga.pets.controllers.world 
